//
//  KKApplyExpertProtocolVC.m
//  DoMi
//
//  Created by 康凯 on 2016/12/7.
//  Copyright © 2016年 kk. All rights reserved.
//

#import "KKApplyExpertProtocolVC.h"
#import "KKApplyExpertTimeVC.h"

@interface KKApplyExpertProtocolVC ()
@property (weak, nonatomic) IBOutlet UIButton *nextBtn;
@property(strong,nonatomic)UIButton *radio;
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@end

@implementation KKApplyExpertProtocolVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"协议";
    [self initNav];
}

#pragma mark ---初始化nav
-(void)initNav{
    //禁止透明
    self.navigationController.navigationBar.translucent=NO;
    //电量颜色设置UIStatusBarStyleLightContent
    [UIApplication sharedApplication].statusBarStyle=UIStatusBarStyleDefault;
    //背景颜色
    self.navigationController.navigationBar.barTintColor=[UIColor colorWithHexString1:@"#F7F8F9"];
    //标题字体颜色
    self.navigationController.navigationBar.titleTextAttributes=[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],NSForegroundColorAttributeName, nil];
    //返回字体颜色
    self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
    
    //左侧排行榜
    UIButton *leftBtn = [[UIButton alloc ]initWithFrame:CGRectMake(0, 0, 12, 20)];
    [leftBtn setImage:[UIImage imageNamed:@"back_blue"] forState:UIControlStateNormal];
    
    [leftBtn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
    
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://domi.zhonghouqianyuan.com/MobileJson/Index/protocle"]]];
    
}
#pragma mark 点击--返回
-(void)back{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark 按钮--同意协议
- (IBAction)statusClick:(id)sender {
    UIButton *btn=sender;
    self.radio=btn;
    if(btn.isSelected){
        btn.selected=NO;
        self.nextBtn.backgroundColor=[UIColor grayColor];
    }else{
        btn.selected=YES;
        self.nextBtn.backgroundColor=[UIColor colorWithHexString:@"#356FD0"];
    }
}
#pragma mark 按钮--下一步
- (IBAction)nextClick:(id)sender {
    if(self.radio.isSelected){
        [self.navigationController popViewControllerAnimated:YES];
        KKApplyExpertTimeVC *time=[[KKApplyExpertTimeVC alloc] init];
        [self.navigationController pushViewController:time animated:YES];
    }else{
        [self toast:@"请同意平台协议"];
    }
}

@end
